var lastX;
var lastY;
var mouseDown = false;

function processEvent(e) {
  var x = e.pageX;
  var y = e.pageY;
  document.getElementById("coords").innerHTML = x + "," + y;
  lastX = x;
  lastY = y;
}

function onLoad() {
  $(document).mousedown(function(e) {
      lastX = e.pageX;
      lastY = e.pageY;
      mouseDown = true;
    });

  $(document).mouseup(function(e) {
      mouseDown = false;
    });
  $(document).mousemove(function(e) {
      if (!mouseDown) return;
      //processEvent(e);
    });
  $("a").mouseover(function(e) {
      processEvent(e);
    });
}
